﻿package com.atn.edamame.tools 
{
	import flash.events.*;
    import flash.display.*;
	import flash.events.*;
    import flash.display.*;
	import flash.text.*;
	import mx.controls.Label;
	import mx.core.UIComponent;
	import com.atn.edamame.*;

	 public class Copy extends EdamameControl
	{
		[Embed(source='../../../../copy.png')]
		private var EmbedImage:Class;

		public override function collide(input: EdamameObject):void
		{
			if (input is EdamameString) {
				var b:EdamameString = input as EdamameString;
				var v:int = b.vy;
				var c:EdamameString = new EdamameString();
				var c2:EdamameString = new EdamameString();
				edamameParent.addEdamameObject(c);
				edamameParent.addEdamameObject(c2);
				c.x = this.x;
				c.y = this.y + this.height + 5;
				c.vy = 2;
				c.value = b.value;
				c2.x = this.x + this.width - 100;
				c2.y = this.y + this.height + 5;
				c2.vy = 2;
				c2.value = b.value;
				b.destroy();
			}
		}
		
        public override function init():void {
			descriptionLabel = new Label();
			descriptionLabel.text = description;
			descriptionLabel.width = 150;
			descriptionLabel.height = 15;
            addChild(descriptionLabel);
			var ui:UIComponent = new UIComponent();
			var img:Bitmap = new EmbedImage() as Bitmap;
			ui.width = 300;
			ui.height = 65;
			ui.addChild(img);
			addChild(ui);
			this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
			this.height = 110;
			this.width = 320;
        }
	}	
	
}